package com.czp.menu.junit;

import java.util.List;

import org.junit.Before;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.czp.menu.mapper.IMenuMapper;
import com.czp.menu.mapper.impl.MenuMapperImpl;
import com.czp.menu.model.Menu;

public class TestMenu {
	private IMenuMapper menuMapper;
	
	//http://www.iteye.com/problems/35919
	
	@Before
	public void initialize() {
		ApplicationContext ctx = new ClassPathXmlApplicationContext(
				"applicationContext.xml");
		menuMapper = (MenuMapperImpl) ctx.getBean("menuMapper");
	}

	@Test
	public void getMenuList() {
		try {
			List<Menu> menus = menuMapper.getMenuList("160");
			for (Menu menu : menus) {
				System.out.println(menu);
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
